


export function returnDataArr(arr) {
    let startDate = new Date(arr[0]);
    let endDate = new Date(arr[1]);

    let datesArray = []
    startDate.setHours(0, 0, 0, 0);

    while (startDate <= endDate) {
        // 将日期添加到数组中datesArray.push(new Date(startDate).toIsostring().slice(0,18));// IS0格式化日期 (YYYY-MM-DD)
        // 把startDate向后推一天
        datesArray.push(newDate(startDate))
        startDate.setDate(startDate.getDate() + 1);


        // console.log(datesArray);//出:['2023-01-01','2023-01-02',...,'2023-01-10']
    }
    return datesArray
}

export function newDate(time) {
    var date = new Date(time)
    var y = date.getFullYear()
    var m = date.getMonth() + 1
    m = m < 10 ? '0' + m : m
    var d = date.getDate()
    d = d < 10 ? '0' + d : d
    return y + '-' + m + '-' + d
}